#include <stdio.h>
#include<string.h>
void swap(char* left,char* right)
{
	while (left < right)
	{
		char tmp = *left;
		*left = *right;
		*right = tmp;
		left++;
		right--;
	}
}

void swap2(char *cur)
{
	while (*cur)
	{
		char* start = cur;
		while (*cur != ' ' && *cur!='\0')
		{
			cur++;
		}
		char* end = cur - 1;
		swap(start,end);
		if (*cur == ' ')
		{
			cur++;
		}
	}
}

int main()
{
	char arr[20] = { 0 };
	gets(arr);
	int left = 0;
	size_t right = strlen(arr) - 1;
	swap(arr,arr+right);
	char* cur = arr;
	swap2(arr);
	printf("%s\0", arr);
	return 0;
}